package cn.lyq.card.ui.order

import cn.lyq.card.base.SimpleVM


class OrderVM : SimpleVM() {

    val pageSize = 10

    fun addGoodsOrder(
        goodsId: Int,
        number: Int,
        paymentType: Int,
        addressId: Int,
        remarks: String
    ) = simpleEmit {
        repository.homeService.addGoodsOrder(goodsId, number, paymentType, addressId, remarks)
    }

    fun updatePaymentType(orderId: String, paymentType: Int) = simpleEmit {
        repository.homeService.updatePaymentType(orderId, paymentType)
    }

    fun getAddressList() = simpleEmit {
        repository.userService.getAddressList()
    }

    fun getOrderDetail(orderId: String) = simpleEmit {
        repository.homeService.getOrderDetails(orderId)
    }

    fun getOrderList(page: Int) = simpleEmit {
        repository.homeService.getOrderList(page, pageSize)
    }
}